]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
status/volume: Create global showOSD() method for StreamSlider
authorSundeep Mediratta <smedius@gmail.com>
Wed, 6 Nov 2024 02:47:34 +0000 (21:47 -0500)
committerFlorian Müllner <fmuellner@gnome.org>
Sun, 10 Nov 2024 23:28:44 +0000 (00:28 +0100)
Abstract the Volume slider OSD display as a global method in the
base class, so that can be reused in all derived classes without
duplicating code.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3531>

js/ui/status/volume.js

index 0ba871bb3b7ada0924dcf78d7cb294d5fc10b945..330476358772de800281e6103c11488b61e72ead 100644 (file)
@@ -276,6 +276,13 @@ const StreamSlider = GObject.registerClass({
 
         return maxVolume / this._control.get_vol_max_norm();
     }
+
+    showOSD() {
+        const gicon = new Gio.ThemedIcon({name: this.getIcon()});
+        const level = this.getLevel();
+        const maxLevel = this.getMaxLevel();
+        Main.osdWindowManager.show(-1, gicon, null, level, maxLevel);
+    }
 });
 
 const OutputStreamSlider = GObject.registerClass(
@@ -425,10 +432,7 @@ class VolumeIndicator extends SystemIndicator {
         if (result === Clutter.EVENT_PROPAGATE || item.mapped)
             return result;
 
-        const gicon = new Gio.ThemedIcon({name: item.getIcon()});
-        const level = item.getLevel();
-        const maxLevel = item.getMaxLevel();
-        Main.osdWindowManager.show(-1, gicon, null, level, maxLevel);
+        item.showOSD();
         return result;
     }
 });